/**
 * Copyright (C)  2011 Kent Tong <freemant2000@yahoo.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.ttdev.ecofoods;


import com.ttdev.ecofoods.R;

import android.graphics.Color;

public class Recommendation {
  private String key;
  private int resId;
  private int color;

  public Recommendation(String key, int resId, int color) {
    this.key = key;
    this.resId = resId;
    this.color = color;
  }

  public String getKey() {
    return key;
  }

  public int getResId() {
    return resId;
  }

  public int getColor() {
    return color;
  }

  private static Recommendation[] RECOMMENDATIONS = {
      new Recommendation("ok", R.string.recommend, Color.GREEN),
      new Recommendation("think_twice", R.string.think_twice, Color.YELLOW),
      new Recommendation("avoid", R.string.avoid, Color.RED) };

  public static Recommendation find(String key) {
    for (Recommendation r : RECOMMENDATIONS) {
      if (r.key.equals(key)) {
        return r;
      }
    }
    throw new IllegalArgumentException("Unknown recommendation key: " + key);
  }
}
